(* Content-type: application/vnd.wolfram.mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 10.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       158,          7]
NotebookDataLength[     13134,        355]
NotebookOptionsPosition[     12127,        316]
NotebookOutlinePosition[     12485,        332]
CellTagsIndexPosition[     12442,        329]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{
Cell["One dimensional linear mapping", "Section",
 CellChangeTimes->{{3.665056388022813*^9, 3.665056403533696*^9}, {
  3.6650728573299503`*^9, 3.665072857863494*^9}}],

Cell[CellGroupData[{

Cell["Element coordinates", "Section",
 CellChangeTimes->{{3.66505651939773*^9, 3.665056530229817*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"p0", "=", 
   RowBox[{"{", 
    RowBox[{"1", ",", "1", ",", "1"}], "}"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"p1", "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"-", "1"}], ",", "1", ",", "1"}], "}"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"p2", "=", 
   RowBox[{"{", 
    RowBox[{"1", ",", 
     RowBox[{"-", "1"}], ",", "1"}], "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"p3", "=", 
   RowBox[{"{", 
    RowBox[{"1", ",", "1", ",", 
     RowBox[{"-", "1"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"els", "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"{", 
      RowBox[{"p0", ",", "p1"}], "}"}], ",", 
     RowBox[{"{", 
      RowBox[{"p1", ",", "p2"}], "}"}], ",", 
     RowBox[{"{", 
      RowBox[{"p2", ",", "p3"}], "}"}], ",", 
     RowBox[{"{", 
      RowBox[{"p3", ",", "p0"}], "}"}]}], "}"}]}], ";"}]}], "Input",
 CellChangeTimes->{{3.665056532225173*^9, 3.665056557670353*^9}, {
  3.665056663998806*^9, 3.665056667566579*^9}, {3.665069927849292*^9, 
  3.665069933152289*^9}, {3.6650704421204147`*^9, 3.665070459721319*^9}, {
  3.665070618456341*^9, 3.665070661072359*^9}, {3.66507184700273*^9, 
  3.665071859478033*^9}, {3.665071892898653*^9, 3.665071919984729*^9}, {
  3.665072091322913*^9, 3.665072108176559*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["Linear mapping", "Section",
 CellChangeTimes->{{3.665056503589859*^9, 3.665056506709682*^9}, {
  3.6650728608181543`*^9, 3.665072861367488*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"L\[Phi]", "=", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{
      FractionBox["1", "2"], 
      RowBox[{"(", 
       RowBox[{"1", "-", "\[Xi]"}], ")"}]}], ",", 
     RowBox[{
      FractionBox["1", "2"], 
      RowBox[{"(", 
       RowBox[{"1", "+", "\[Xi]"}], ")"}]}]}], "}"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"XL", "[", 
    RowBox[{"\[Phi]_", ",", "xcoor_"}], "]"}], "=", 
   RowBox[{"\[Phi]", ".", "xcoor"}]}], ";"}]}], "Input",
 CellChangeTimes->{{3.665056561088571*^9, 3.6650566175345783`*^9}, {
  3.6650712755411873`*^9, 3.665071275963586*^9}, {3.665071415514318*^9, 
  3.665071456311211*^9}, {3.6650715078345137`*^9, 3.6650715500572367`*^9}, {
  3.665071617338531*^9, 3.6650716305688868`*^9}, {3.6650716786338463`*^9, 
  3.66507175608843*^9}, {3.665073070166052*^9, 3.665073071491281*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["X(\[Xi]) mapping ", "Section",
 CellChangeTimes->{{3.665056622597714*^9, 3.665056627709565*^9}, {
  3.665072864090125*^9, 3.665072870759647*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"X", "[", 
    RowBox[{"\[Phi]_", ",", "xcoor_"}], "]"}], "=", 
   RowBox[{"XL", "[", 
    RowBox[{"\[Phi]", ",", "xcoor"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"GradXexp", "=", 
   RowBox[{"Grad", "[", 
    RowBox[{
     RowBox[{"X", "[", 
      RowBox[{"L\[Phi]", ",", "xcoor"}], "]"}], ",", 
     RowBox[{"{", "\[Xi]", "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"GradX", "[", "xcoor_", "]"}], "=", "GradXexp"}], ";"}]}], "Input",\

 CellChangeTimes->{{3.665056639152625*^9, 3.665056647039544*^9}, {
   3.6650706677284117`*^9, 3.66507073187227*^9}, 3.66507076215528*^9, {
   3.665070794744328*^9, 3.665070832907311*^9}, {3.665071141874402*^9, 
   3.6650711636644983`*^9}, {3.665071200423388*^9, 3.665071208700766*^9}, {
   3.665071479154251*^9, 3.665071480202228*^9}, {3.665072220739332*^9, 
   3.665072245560796*^9}, {3.665072277544651*^9, 3.6650722956167097`*^9}, {
   3.6650723488254213`*^9, 3.6650723498786097`*^9}, {3.665072965483306*^9, 
   3.6650729947325*^9}}],

Cell[CellGroupData[{

Cell[BoxData[{
 RowBox[{
  RowBox[{"\[Xi]p", "=", 
   RowBox[{"-", "1.0"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"For", "[", 
   RowBox[{
    RowBox[{"i", "=", "1"}], ",", 
    RowBox[{"i", "\[LessEqual]", " ", "4"}], ",", 
    RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"Print", "[", 
      RowBox[{"{", 
       RowBox[{"\"\<X = \>\"", ",", 
        RowBox[{
         RowBox[{"X", "[", 
          RowBox[{"L\[Phi]", ",", 
           RowBox[{"els", "[", 
            RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "/.", 
         RowBox[{"\[Xi]", "->", "\[Xi]p"}]}]}], "}"}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"Print", "[", 
      RowBox[{"{", 
       RowBox[{"\"\<Grad of X = \>\"", ",", 
        RowBox[{
         RowBox[{"GradX", "[", 
          RowBox[{"els", "[", 
           RowBox[{"[", "i", "]"}], "]"}], "]"}], "/.", 
         RowBox[{"\[Xi]", "->", "\[Xi]p"}]}], ",", 
        RowBox[{
         RowBox[{"Dimensions", "[", 
          RowBox[{"GradX", "[", 
           RowBox[{"els", "[", 
            RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}], " ", "/.", 
         RowBox[{"\[Xi]", "->", "\[Xi]p"}]}]}], "}"}], "]"}], ";"}]}], 
   "\[IndentingNewLine]", "]"}], ";"}]}], "Input",
 CellChangeTimes->{{3.6650706860233383`*^9, 3.6650706948188753`*^9}, {
   3.665070738491704*^9, 3.665070744440419*^9}, {3.665070836424273*^9, 
   3.6650709058652067`*^9}, {3.665070959130547*^9, 3.6650710695929823`*^9}, 
   3.665071134587174*^9, {3.665071214785551*^9, 3.665071235995173*^9}, {
   3.665071269753755*^9, 3.665071291340974*^9}}],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"X = \"\>", ",", 
   RowBox[{"{", 
    RowBox[{"1.`", ",", "1.`", ",", "1.`"}], "}"}]}], "}"}]], "Print",
 CellChangeTimes->{{3.665070866585092*^9, 3.665070906424777*^9}, 
   3.6650709712600727`*^9, {3.665071006547703*^9, 3.665071048654336*^9}, {
   3.6650710975833387`*^9, 3.66507114401719*^9}, {3.665071236783328*^9, 
   3.665071291702422*^9}, {3.665071439691434*^9, 3.665071459661374*^9}, 
   3.665071512236197*^9, 3.665071699997882*^9, 3.665072213278562*^9, 
   3.665072247063212*^9, 3.665072302253025*^9, {3.665072352853303*^9, 
   3.66507236396906*^9}, {3.665072971504951*^9, 3.6650730065083857`*^9}, 
   3.6650730728468943`*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"Grad of X = \"\>", ",", 
   RowBox[{"{", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"-", "1"}], ",", "0", ",", "0"}], "}"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"1", ",", "3"}], "}"}]}], "}"}]], "Print",
 CellChangeTimes->{{3.665070866585092*^9, 3.665070906424777*^9}, 
   3.6650709712600727`*^9, {3.665071006547703*^9, 3.665071048654336*^9}, {
   3.6650710975833387`*^9, 3.66507114401719*^9}, {3.665071236783328*^9, 
   3.665071291702422*^9}, {3.665071439691434*^9, 3.665071459661374*^9}, 
   3.665071512236197*^9, 3.665071699997882*^9, 3.665072213278562*^9, 
   3.665072247063212*^9, 3.665072302253025*^9, {3.665072352853303*^9, 
   3.66507236396906*^9}, {3.665072971504951*^9, 3.6650730065083857`*^9}, 
   3.665073072852062*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"X = \"\>", ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"-", "1.`"}], ",", "1.`", ",", "1.`"}], "}"}]}], "}"}]], "Print",\

 CellChangeTimes->{{3.665070866585092*^9, 3.665070906424777*^9}, 
   3.6650709712600727`*^9, {3.665071006547703*^9, 3.665071048654336*^9}, {
   3.6650710975833387`*^9, 3.66507114401719*^9}, {3.665071236783328*^9, 
   3.665071291702422*^9}, {3.665071439691434*^9, 3.665071459661374*^9}, 
   3.665071512236197*^9, 3.665071699997882*^9, 3.665072213278562*^9, 
   3.665072247063212*^9, 3.665072302253025*^9, {3.665072352853303*^9, 
   3.66507236396906*^9}, {3.665072971504951*^9, 3.6650730065083857`*^9}, 
   3.665073072857902*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"Grad of X = \"\>", ",", 
   RowBox[{"{", 
    RowBox[{"{", 
     RowBox[{"1", ",", 
      RowBox[{"-", "1"}], ",", "0"}], "}"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"1", ",", "3"}], "}"}]}], "}"}]], "Print",
 CellChangeTimes->{{3.665070866585092*^9, 3.665070906424777*^9}, 
   3.6650709712600727`*^9, {3.665071006547703*^9, 3.665071048654336*^9}, {
   3.6650710975833387`*^9, 3.66507114401719*^9}, {3.665071236783328*^9, 
   3.665071291702422*^9}, {3.665071439691434*^9, 3.665071459661374*^9}, 
   3.665071512236197*^9, 3.665071699997882*^9, 3.665072213278562*^9, 
   3.665072247063212*^9, 3.665072302253025*^9, {3.665072352853303*^9, 
   3.66507236396906*^9}, {3.665072971504951*^9, 3.6650730065083857`*^9}, 
   3.665073072860127*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"X = \"\>", ",", 
   RowBox[{"{", 
    RowBox[{"1.`", ",", 
     RowBox[{"-", "1.`"}], ",", "1.`"}], "}"}]}], "}"}]], "Print",
 CellChangeTimes->{{3.665070866585092*^9, 3.665070906424777*^9}, 
   3.6650709712600727`*^9, {3.665071006547703*^9, 3.665071048654336*^9}, {
   3.6650710975833387`*^9, 3.66507114401719*^9}, {3.665071236783328*^9, 
   3.665071291702422*^9}, {3.665071439691434*^9, 3.665071459661374*^9}, 
   3.665071512236197*^9, 3.665071699997882*^9, 3.665072213278562*^9, 
   3.665072247063212*^9, 3.665072302253025*^9, {3.665072352853303*^9, 
   3.66507236396906*^9}, {3.665072971504951*^9, 3.6650730065083857`*^9}, 
   3.665073072862362*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"Grad of X = \"\>", ",", 
   RowBox[{"{", 
    RowBox[{"{", 
     RowBox[{"0", ",", "1", ",", 
      RowBox[{"-", "1"}]}], "}"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"1", ",", "3"}], "}"}]}], "}"}]], "Print",
 CellChangeTimes->{{3.665070866585092*^9, 3.665070906424777*^9}, 
   3.6650709712600727`*^9, {3.665071006547703*^9, 3.665071048654336*^9}, {
   3.6650710975833387`*^9, 3.66507114401719*^9}, {3.665071236783328*^9, 
   3.665071291702422*^9}, {3.665071439691434*^9, 3.665071459661374*^9}, 
   3.665071512236197*^9, 3.665071699997882*^9, 3.665072213278562*^9, 
   3.665072247063212*^9, 3.665072302253025*^9, {3.665072352853303*^9, 
   3.66507236396906*^9}, {3.665072971504951*^9, 3.6650730065083857`*^9}, 
   3.665073072864646*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"X = \"\>", ",", 
   RowBox[{"{", 
    RowBox[{"1.`", ",", "1.`", ",", 
     RowBox[{"-", "1.`"}]}], "}"}]}], "}"}]], "Print",
 CellChangeTimes->{{3.665070866585092*^9, 3.665070906424777*^9}, 
   3.6650709712600727`*^9, {3.665071006547703*^9, 3.665071048654336*^9}, {
   3.6650710975833387`*^9, 3.66507114401719*^9}, {3.665071236783328*^9, 
   3.665071291702422*^9}, {3.665071439691434*^9, 3.665071459661374*^9}, 
   3.665071512236197*^9, 3.665071699997882*^9, 3.665072213278562*^9, 
   3.665072247063212*^9, 3.665072302253025*^9, {3.665072352853303*^9, 
   3.66507236396906*^9}, {3.665072971504951*^9, 3.6650730065083857`*^9}, 
   3.665073072867264*^9}],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{"\<\"Grad of X = \"\>", ",", 
   RowBox[{"{", 
    RowBox[{"{", 
     RowBox[{"0", ",", "0", ",", "1"}], "}"}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{"1", ",", "3"}], "}"}]}], "}"}]], "Print",
 CellChangeTimes->{{3.665070866585092*^9, 3.665070906424777*^9}, 
   3.6650709712600727`*^9, {3.665071006547703*^9, 3.665071048654336*^9}, {
   3.6650710975833387`*^9, 3.66507114401719*^9}, {3.665071236783328*^9, 
   3.665071291702422*^9}, {3.665071439691434*^9, 3.665071459661374*^9}, 
   3.665071512236197*^9, 3.665071699997882*^9, 3.665072213278562*^9, 
   3.665072247063212*^9, 3.665072302253025*^9, {3.665072352853303*^9, 
   3.66507236396906*^9}, {3.665072971504951*^9, 3.6650730065083857`*^9}, 
   3.6650730728696747`*^9}]
}, Open  ]]
}, Open  ]]
}, Open  ]]
},
WindowSize->{1213, 1112},
WindowMargins->{{4, Automatic}, {Automatic, 4}},
FrontEndVersion->"10.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (September 9, \
2014)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[558, 20, 166, 2, 64, "Section"],
Cell[CellGroupData[{
Cell[749, 26, 103, 1, 50, "Section"],
Cell[855, 29, 1345, 39, 97, "Input"]
}, Open  ]],
Cell[CellGroupData[{
Cell[2237, 73, 150, 2, 64, "Section"],
Cell[2390, 77, 869, 23, 68, "Input"]
}, Open  ]],
Cell[CellGroupData[{
Cell[3296, 105, 151, 2, 64, "Section"],
Cell[3450, 109, 1079, 25, 63, "Input"],
Cell[CellGroupData[{
Cell[4554, 138, 1596, 40, 97, "Input"],
Cell[CellGroupData[{
Cell[6175, 182, 678, 12, 21, "Print"],
Cell[6856, 196, 785, 16, 21, "Print"],
Cell[7644, 214, 699, 14, 21, "Print"],
Cell[8346, 230, 785, 16, 21, "Print"],
Cell[9134, 248, 697, 13, 21, "Print"],
Cell[9834, 263, 785, 16, 21, "Print"],
Cell[10622, 281, 697, 13, 21, "Print"],
Cell[11322, 296, 765, 15, 21, "Print"]
}, Open  ]]
}, Open  ]]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
